package com.psl.action.work.halfproductkc;

import com.psl.services.work.halfproductkc;
import org.apache.struts2.ServletActionContext;

import javax.servlet.http.HttpServletRequest;

public class Update_num_out
{
  public String execute()
  {
    HttpServletRequest request = ServletActionContext.getRequest();
    String h_no = request.getParameter("h_no");
    String h_size = request.getParameter("h_size");
    String h_r = request.getParameter("h_r");
    String h_n = request.getParameter("h_n");
    int h_num_old = Integer.parseInt(request.getParameter("h_num_old"));
    int h_num = Integer.parseInt(request.getParameter("h_num"));
    int h_num_out = Integer.parseInt(request.getParameter("h_num_out"));
    int h_num_now = h_num_old + h_num - h_num_out;
    if (h_num_now > 0)
    {
      halfproductkc hps = new halfproductkc();
      hps.updateleftkc(h_num_now, h_no, h_size, h_r, h_n);
    }
    else
    {
      request.setAttribute("s", "<script>alert('库存不足，不能出库')</script>");
    }
    return "success";
  }
}
